package com.asset.dispoal.business.reportAnalysis.service.common;

import com.asset.dispoal.business.bsAgreement.domain.db.mapper.AgreementMapper;
import com.asset.dispoal.business.reportAnalysis.dto.AnalysisResultResponse;
import com.asset.dispoal.business.reportAnalysis.dto.StatisticsAgencyAgreeInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @description:
 * @author: yf
 * @date: 2022-09-21 10:47:13
 */
@Repository
public class StatisticsAgreementCommand {
    @Autowired
    private AgreementMapper agreementMapper;

    public AnalysisResultResponse execute() {
        AnalysisResultResponse response = new AnalysisResultResponse();
        //合同总数量
        response.setNumContracts(agreementMapper.getAgreeNums());
        response.setThisWeekNewContracts(agreementMapper.getThisWeekNewAgreeNums());
        //可派送合同数量
        response.setSentContracts(agreementMapper.getSentAgreeNums());
        response.setThisWeekNewSentContracts(agreementMapper.getThisWeekSentAgreeNums());
        //不可派送合同数量
        response.setNotToBeSentContracts(agreementMapper.getNotSentAgreeNums());
        response.setThisWeekNewNotToBeSentContracts(agreementMapper.getThisWeekNotSentAgreeNums());
        //机构统计合同
        List<StatisticsAgencyAgreeInfo> agencyStatistics = agreementMapper.getContractAgencyStatistics();
        response.setContractAgencyStatistics(agencyStatistics);
        //种类统计合同
        response.setContractKindStatistics(agreementMapper.getContractKindStatistics());

        //TODO  数据未优化完成，待处理
        return response;
    }
}
